package com.wzh.design.proxy.proxy2;

import com.wzh.design.proxy.proxy1.BuyHouse;
import com.wzh.design.proxy.proxy1.BuyHouseImpl;

import java.lang.reflect.Proxy;

/**
 * @description:
 * @author: WZH
 * @time: 2021/6/9 14:26
 */
public class DynamicProxyTest {
    public static void main(String[] args) {
        BuyHouseImpl buyHouse = new BuyHouseImpl();

        BuyHouse proxyBuyHouse = (BuyHouse)Proxy.newProxyInstance(BuyHouse.class.getClassLoader(),
                new Class[]{BuyHouse.class}, new DynamicProxyHandler(buyHouse));
        proxyBuyHouse.buyHosue();

    }
}
